
SERVICE_FILE_EXTENTION 	= c
SERVICE_SRC_PATH     	= $(MAIN_SERVICE_PATH)/source
SERVICE_INCLUDE_PATH 	= 	$(MAIN_SERVICE_PATH)/include \
							$(APPLICATION_INCLUDE_PATH)
SERVICE_OBJS_PATH    	= $(MAIN_OBJS_PATH)/SERVICE
SERVICE_DEPS_PATH		= $(MAIN_DEPS_PATH)/SERVICE
SERVICE_CFLAGS			= $(MAIN_CODE_CFLAGS)
SERVICE_DEPEND_CFLAGS	= $(MAIN_DEPEND_CFLAGS)

SERVICE_INCLUDE	= $(addprefix -I, $(SERVICE_INCLUDE_PATH))
SERVICE_SRCS	= $(wildcard $(SERVICE_SRC_PATH)/*.$(SERVICE_FILE_EXTENTION))
SERVICE_OBJS	= $(addprefix $(SERVICE_OBJS_PATH)/,$(notdir $(subst .$(SERVICE_FILE_EXTENTION),.o,$(SERVICE_SRCS))))
SERVICE_DEPS	= $(addprefix $(SERVICE_DEPS_PATH)/,$(notdir $(subst .$(SERVICE_FILE_EXTENTION),.d,$(SERVICE_SRCS))))
ALL_OBJS 	 += $(SERVICE_OBJS)
ALL_DEPS	 += $(SERVICE_DEPS)

$(SERVICE_DEPS_PATH)/%.d : $(SERVICE_SRC_PATH)/%.$(SERVICE_FILE_EXTENTION)
	@$(MKDIR) $(SERVICE_DEPS_PATH)
	@echo Making $(notdir $@) ...
	@$(CC) $(SERVICE_DEPEND_CFLAGS) $(SERVICE_INCLUDE) $< | sed 's/$*.o:/$(subst /,\/,$(SERVICE_OBJS_PATH))\/$*.o:/g' > $@
	@echo Done!

-include $(SERVICE_DEPS)

$(SERVICE_OBJS_PATH)/%.o : $(SERVICE_SRC_PATH)/%.$(SERVICE_FILE_EXTENTION)
	@$(MKDIR) $(SERVICE_OBJS_PATH)
	@echo Making $(notdir $@) ...
	@$(CC) $(SERVICE_CFLAGS) $(SERVICE_INCLUDE) $< -c -o $@
	@echo Done!


